//
//  UserTool.swift
//  DollarBuy
//
//  Created by 郑东喜 on 2016/11/10.
//  Copyright © 2016年 郑东喜. All rights reserved.
//

import UIKit

class UserTool: NSObject {
    static let shared : UserTool = UserTool()

    
    func alert(msg : String ) -> Void {
        
        
        let alertController = UIAlertController(title: "提示", message: msg, preferredStyle: UIAlertControllerStyle.alert)

//        alertController.addAction(UIAlertAction(title: "确认", style: UIAlertActionStyle.default, handler: nil))
        
        UIApplication.shared.keyWindow?.rootViewController?.present(alertController, animated: true, completion: nil)
        
        //延时1s执行
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + TimeInterval(Int64(1 * NSEC_PER_SEC))/Double(NSEC_PER_SEC)) {
            //code
            
            UIView.animate(withDuration: 0.3, animations: {
                alertController.dismiss(animated: true, completion: nil)
            })
        }
    }
}

extension UserTool {
    
}
